<?php

declare(strict_types=1);

namespace App\Controller\Notify;

use App\Controller\AbstractController;
use Hyperf\HttpServer\Contract\RequestInterface;
use Hyperf\HttpServer\Annotation\Controller;
use Hyperf\HttpServer\Annotation\RequestMapping;
use App\Service\OrderService\OrderNotifyService\GwNotifyService;
use App\Service\TaskServer\TaskWorker;

/**
 * 关务接口统一回调入口
 * @Controller(prefix="/Notify/index/userType/shopgw/messageType")
 */
class GwController extends AbstractController
{
    /**
     * @RequestMapping(path="OrderExpress", methods="post")
     * 接收轨迹查询接口
     * @param RequestInterface $request
     */
    public function orderTraceLogistics(RequestInterface $request)
    {
        return TaskWorker::instance()->addWebNotifyTask(GwNotifyService::class,'orderTraceLogistics',$request->getParsedBody());
    }

    /**
     * @RequestMapping(path="GoodsReceive/supplierID/{supplierID}", methods="post")
     * 接收轨迹查询接口
     * @param RequestInterface $request
     */
    public function GoodsReceive(RequestInterface $request,$supplierID)
    {
        $data=$request->getParsedBody();
        $data['supplierID']=$supplierID;
        return TaskWorker::instance()->addWebNotifyTask(GwNotifyService::class,'goodsReceive',$data);
    }
    
    /**
     * @RequestMapping(path="MessageRev/supplierID/{supplierID}", methods="post")
     * 关务消息接收功能
     * @param RequestInterface $request
     */
    public function MessageRev(RequestInterface $request,$supplierID)
    {
        $data=$request->getParsedBody();
        $data['supplierID']=$supplierID;
        return TaskWorker::instance()->addWebNotifyTask(GwNotifyService::class,'MessageRev',$data);
    }
}